<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>touch和click混用4</title>
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
    <style>
        #box {
            height: 100vh;
            background: #d6d8b4;
            padding: 20px;
            font-size: 18px;
        }

        #touch-box {
            position: absolute;
            width: 100%;
            top: 20vh;
            min-height: 60px;
            left: 0;
            padding: 12px;
            line-height: 30px;
            color: #fff;
            background: #6ca0e4;
            opacity: .92;
        }

        div.bottom-el {
            min-height: 30vh;
            font-size: 18px;
            background: #bfd65a;
        }
    </style>
</head>

<body>
    <div id="box">
        容器 id="box" <br><b>使用CDN-bootstrap-3.3.5、CDN-jQuery-mobile-1.4.5</b>
        <div class="bottom-el">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eligendi earum aut voluptate
            vero velit sunt atque consequatur aspernatur in nam hic omnis quidem, culpa ipsa illo assumenda debitis
            dignissimos eveniet!</div>
        <div id="ts"></div>
        <div id="ty"></div>
        <div id="tw"></div>
        <div id="tx"></div>
        <div id="tz"></div>
        <div id="touch-box">测试容器 id="touch-box"</div>
    </div>

    <script src="https://cdn.bootcss.com/jquery/1.9.1/jquery.js"></script>
    <!-- <script src="https://www.yunjingzhi.com/yunjingservice/js/jquery/mobile/jquery.mobile.custom.min.js"></script> -->
    <script src="https://cdn.bootcss.com/jquery-mobile/1.4.5/jquery.mobile.js"></script>
    <script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
    <script src="https://cdn.bootcss.com/twitter-bootstrap/3.3.4/js/bootstrap.js"></script>
    <script>
        var str = '',
            bum = 0;

        function ab() {
            return 3
        }
        $("#box").click(function () {
            $("#ts").text("box click - " + bum);
            bum++;
        })
        var s = $("#touch-box");
        s.on("touchstart", function () {
            s.html(s.html() + " " + bum);
            $("#tw").text("touch-box touchstart - " + bum);
            bum++;
        })
        s.on("swipeleft", function () {
            layer.msg("left")
            $("#tx").text("touch-box swipeleft - " + bum);
            bum++;
        })
        s.on("swiperight", function () {
            layer.msg("right")
            $("#tz").text("touch-box swiperight - " + bum);
            bum++;
        })
        s.on("click.fd", function (e) {
            //$(this).css("display", "none");
            //e.stopPropagation();
            $("#ty").text("touch-box click - " + bum);
            bum++;
            console.log("x")
        })
        $(".bottom-el").on("click", function () {
            $(this).text("点击-bottom-el - " + bum);
            bum++;
        })
    </script>
</body>

</html>